<?php


namespace app\api\library\order\confirmOrder;


use app\api\model\MallOrder;

class V
{
    public static function run($param)
    {
        $userId  = _checkEmptyParam($param[ 'userId' ], '用户ID不能为空');
        $orderId = _checkEmptyParam($param[ 'orderId' ], '订单ID不能为空');
        $order   = MallOrder::where([ ['id', '=', $orderId]])->find();
        if (empty($order)) {
            _outPut(204, [], '订单不存在');
        }
        if ($order->order_status!=50) {
            _outPut(204, [], '订单状态异常');
        }
        if (false === MallOrder::where('id', $orderId)->update(['order_status' => 60,'receipt_time'=>time()])) {
            _outPut(204, [], '订单确认收货失败');
        }
        _outPut(200, [], '申请确认收货成功');
    }
}